<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div>
        <img src="img/0.png" alt="">
        <img src="img/0.png" alt="">
        :
        <img src="img/0.png" alt="">
        <img src="img/0.png" alt="">
        :
        <img src="img/0.png" alt="">
        <img src="img/0.png" alt="">
    </div>
</body>

</html>
<script>
    window.onload = function () {
       

        function showTime() {
            setInterval(function () {
                var date = new Date()
                var arr = [
                    //获取当前时间计算,算出位数
                    parseInt(date.getHours() / 10),
                    date.getHours() % 10,
                    parseInt(date.getMinutes() / 10),
                    date.getMinutes() % 10,
                    parseInt(date.getSeconds() / 10),
                    date.getSeconds() % 10,
                ]
                // console.log(arr)
                var imgs = document.getElementsByTagName("img")
                for (var i = 0; i < arr.length; i++) {
                    imgs[i].src = "img/" + arr[i] + ".png";
                }

            }, 1000)
        }
        showTime()

    }
</script>